<template>
	<view>
		<u-empty mode="favor" text="暂未浏览任何商品,快去逛逛吧" iconColor="#f18b49" style="margin-top: 100rpx;" v-if="data == ''"></u-empty>
		<u-swipe-action style="margin: 15rpx 10rpx; 0 10rpx;" v-for="(item,index) in data" :key="index" v-else>
			<u-swipe-action-item autoClose :options="options" style="border-radius: 20rpx;" @click="swipeActionItem(item.id )">
				<view class="cart-list-box">
					<view class="list-box-head">
						<view class="head-left">
							<image src="../../static/cart/store.png" mode=""></image>
							<text>国集采供应链</text>
							<u-icon name="arrow-right" size="12" style="margin: 4rpx 0 0 4rpx;"></u-icon>
						</view>
						<view class="head-right">
							
						</view>
					</view>
					<view class="list-box-cont" @click="toProductDetail(item.id)">
						<view class="listbox-cont-left" @click="jump_url(item.id)">
							<image :src="baseUrl + item.img"></image>
						</view>
						<view class="listbox-cont-right">
							<view class="cont-right-top">
								<view class="cont-tit" @click="jump_url(item.id)">{{ item.name }} </view>
							</view>
							<view class="cont-right-bot">
								<text class="price-icon">￥</text>
								<text class="price-tit">{{ item.price }}</text>
							</view>
						</view>
					</view>
				</view>
			</u-swipe-action-item>
		</u-swipe-action>
	</view>
</template>

<script>
	export default {
		
		data() {
			return {
				user_id:'',
				foot_goods_id:'',
				data:[],
				baseUrl: 'https://gjc.hy-dzsc.cn/',
			}
		},
		onLoad(e){
			this.user_id = uni.getStorageSync('userid')
			this.foot_goods_id = uni.getStorageSync('foot_goods_id')
			this.getFootPrintInfo()
		},
		onShow(e){
			
		},
		methods: {
			//获取浏览记录
			getFootPrintInfo(){
				this.$getHttp(`/gjcApi/get_visit_info?user_id=${this.user_id}`,{'ids':this.foot_goods_id},res=>{
					if(res.code == 200){
						this.data = res.data
					}
				})
			},
			jump_url(id){
				uni.navigateTo({
                    url: `/pages/class/product-detail?proId=${id}&user_id=${this.user_id}`
                })
			}
		}
	}
</script>

<style lang="scss" scoped>
.cart-list-box{
	padding: 25rpx 20rpx;
	border-radius: 20rpx;
	background: $uni-model-color;
	.list-box-head{
		display: flex;
		align-items: center;
		justify-content: space-between;
		.head-left{
			display: flex;
			align-items: center;
			image{
				width: 36rpx;
				height: 36rpx;
				margin-right: 8rpx;
			}
			text{
				font-size: 28rpx;
				font-weight: bold;
				letter-spacing: 1rpx;
			}
		}
		.head-right{
			font-size: 24rpx;
			color: $uni-text-color-grey;
		}
	}
	.list-box-cont{
		display: flex;
		margin-top: 30rpx;
		.listbox-cont-left{
			display: flex;
			align-items: center;
			image{
				// flex-shrink: 1;
				width: 200rpx;
				height: 200rpx;
				margin-left: 4rpx;
				border-radius: 10rpx;
				border: 2rpx solid $uni-text-color;
			}
		}
		.listbox-cont-right{
			width: 482rpx;
			display: flex;
			margin-left: 20rpx;
			flex-direction: column;
			justify-content: space-between;
			.cont-right-top{
				overflow:hidden;
				font-size: 28rpx;
				font-weight: bold;
				letter-spacing: 1rpx;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
			.cont-spec{
				font-size: 22rpx;
				padding: 10rpx;
				border-radius: 8rpx;
				margin: 15rpx 0 35rpx 0;
				color: $uni-text-color-grey;
				background-color:rgba(0, 0, 0, .1);
			}
			.cont-right-bot{
				display: flex;
				align-items: baseline;
				color: $uni-text-color;
				justify-content: flex-end;
				.price-icon{
					font-size: 24rpx;
				}
				.price-tit{
					font-size: 34rpx;
					font-weight: bold;
				}
			}
		}
	}
}
</style>
